using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class bullet_ball : MonoBehaviour
{   
    public int speed;
    private float timer; 
    private float lifeTime = 1;
    public float distance;
    void Start()
    {
        timer = 0;
    }

    void Update()
    {
        FollowBall();
        timer +=Time.deltaTime;
        if(timer>lifeTime){
            Destroy(gameObject);
        }
    }
    void FollowBall(){
        transform.Translate(Vector3.forward*Time.deltaTime*speed,Space.Self);
    }

    private void OnTriggerEnter(Collider other) {
        Destroy(gameObject);
    }
}
